<template>
    <el-form :model="form" label-width="120px">
        <el-form-item label="推荐名称">
            <el-input v-model="recommend.name" />
        </el-form-item>
        <el-form-item label="超链接">
            <el-input v-model="recommend.url" />
        </el-form-item>
        <el-form-item label="推荐图">
            <ImgUpload :imgurl="recommend.img" @seturl="handleImg" />
        </el-form-item>
        <el-form-item label="广告描述">
            <el-input v-model="recommend.desc" type="textarea" />
        </el-form-item>

        <el-form-item label="是否上架">
            <el-switch v-model="recommend.isshow" />
        </el-form-item>


        <el-form-item>
            <el-button type="primary" @click="handleSubmit">提交</el-button>
            <el-button>重置</el-button>
        </el-form-item>
    </el-form>
</template>

<script>
import request from '../../server/request';
import ImgUpload from "../../components/ImgUpload.vue";
export default {
    data() {
        return {
            recommend: {
                name: "",
                url: "",
                desc: "",
                img: "",
                isshow: true,
            }
        }
    },
    methods: {
        handleSubmit() {
            console.log(this.recommend)
            request.post('/classes/Recommend',this.recommend)
        },
        handleImg(url) {
            console.log(url);
            this.recommend.img = url;
        },
    }
}
</script>


<style lang="scss" scoped>

</style>